package jee.boot.common.basic;

import jee.boot.common.basic.result.ResponseMessage;
import jee.boot.common.basic.result.Result;
import jee.boot.common.utils.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * TreeController
 * @param <S>
 */
public abstract class TreeController<S extends  TreeService,T extends  TreeEntity<T>> extends CrudController<S ,T>  {
    /**
     * 树
     *
     * @param entity
     * @return
     */
    @PostMapping("/treeData")
    public ResponseMessage<List<T>> treeData(@RequestBody T entity) {
        List<T> list = service.findList(entity);
        List<T> tree = service.buildTree(list);
        return Result.success(tree);
    }

}
